#测试登录业务

import time,os,sys

import pytest

sys.path.append(os.getcwd())

from utils.initDriver import init_driver
from service.service_login import ServiceLogin

from utils.readConfigFileUtils import readConfig
from utils.readCesiDataUtils import yaml_data_with_file

class TestLogin(object):
    def setup_class(self):
        self.base_url = readConfig("config/webConfig.yaml")["base_url"]

    def teardown_class(self):
        pass

    def setup(self):
        #初始化driver
        self.driver=init_driver()
        #初始化该业务的业务对象
        self.service_login=ServiceLogin(self.driver,self.base_url)

    def teardown(self):
        time.sleep(5)
        self.driver.quit()

    @pytest.mark.parametrize("d,",yaml_data_with_file("data/data_login.yaml","test_login_001"))
    def teXXst_login_001(self,d):
        assert self.service_login.service_login_001(d)

    @pytest.mark.parametrize("d,", yaml_data_with_file("data/data_login.yaml", "test_login_002"))
    def teXXXst_login_002(self, d):
        assert self.service_login.service_login_002(d)

    @pytest.mark.parametrize("d,", yaml_data_with_file("data/data_login.yaml", "test_login_003"))
    def teXXXst_login_003(self, d):
        assert self.service_login.service_login_003(d)

    @pytest.mark.parametrize("d,", yaml_data_with_file("data/data_login.yaml", "test_login_004"))
    def test_login_004(self, d):
        assert self.service_login.service_login_004(d)

